TOC2: catch headers in text in output cells created using Markdown()#1394
TOC2: catch headers in text in output cells created using Markdown()#1394JonAnCla wants to merge 4 commits intoipython-contrib:masterfrom
Conversation
… using Markdown().
This allows programmatic creation of the TOC e.g. the following will now create an entry in the TOC when "run_alternative_scenario" is True
```
if run_alternative_scenario:
display(Markdown('# Results from alt scenario')
```
Although this change makes TOC2 add headers from Markdown() text, the TOC is not automatically updated when such cells are added/changed.
Would appreciate help in getting automatic updates working!
|
Thanks @hottwaj for the contribution. Given that this changes the default behaviour though, I think it ought to be made optional with a parameter. Could you implement that? |
|
Hey sure I can check that out. Any thoughts on the trigger that is needed to update the TOC when you press ctrl+enter on a cell that contains Markdown? Thanks! |
|
@hottwaj Digging a little, I don't see a signal emitted when the Otherwise I agree with @jcb91 that an option for this would be useful. |
|
@jfbercher Thanks for checking that out, maybe I can look into that if it becomes more necessary - at the moment the contents generally gets re-rendered at some point whenever a few cells are executed, so I haven't found it too problematic. I haven't found time to look into making it an optional feature, but will try to (likely timescale: several weeks at least). Cheers |
|
appreciate that this is 2 years later and likely this repo is not going to see more maintenance... but I finally made that minor change (added a menu option)! Thanks |
Make TOC2 also catch headers in text in output cells that was created using Markdown().
This allows programmatic creation of the TOC e.g. the following will now create an entry in the TOC when "run_alternative_scenario" is True
Although this change makes TOC2 add headers from Markdown() text, the TOC is not automatically updated when such cells are added/changed. (You have to click the TOC2 "refresh" button to trigger an update)
Would appreciate help in getting automatic updates working!
Thanks